/*
 * Copyright (c) 2009, Jan Pastor. All Rights Reserved.
 */

package sk.jp.commons.ui;

import java.awt.*;
import javax.swing.*;

/**
 * Panel designed for using inside parent panel with {@link BoxLayout}.
 * <p>This panel has dynamic width but height is depending on inner components.
 */
public class LinePanel extends JPanel {

    public LinePanel(LayoutManager layout, boolean isDoubleBuffered) {
        super(layout, isDoubleBuffered);
    }

    public LinePanel(LayoutManager layout) {
        super(layout);
    }

    public LinePanel(boolean isDoubleBuffered) {
        super(isDoubleBuffered);
    }

    public LinePanel() {
    }

    //----------------------------------------------------------------------

    @Override
    public Dimension getMaximumSize() {
        Dimension origPrefSize = super.getPreferredSize();
        Dimension origMaxSize = super.getMaximumSize();
        Dimension maxSize = new Dimension(origMaxSize.width, origPrefSize.height);
        return maxSize;
    }
    
}
